home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / catD / srv.z / srv
Encoding:
Text File  |  2002-10-03  |  12.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4. ssssrrrrvvvv((((DDDD2222))))                                                                ssssrrrrvvvv((((DDDD2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_rrrr_vvvv - service queued messages
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_tttt_rrrr_oooo_pppp_tttt_ssss_...._hhhh_>>>>
  15.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
  16.      _iiii_nnnn_tttt _p_r_e_f_i_x_rrrr_ssss_rrrr_vvvv_((((_qqqq_uuuu_eeee_uuuu_eeee______tttt _****_q_))))_;;;;  _////_**** _rrrr_eeee_aaaa_dddd _ssss_iiii_dddd_eeee _****_////
  17.      _iiii_nnnn_tttt _p_r_e_f_i_x_wwww_ssss_rrrr_vvvv_((((_qqqq_uuuu_eeee_uuuu_eeee______tttt _****_q_))))_;;;;  _////_**** _wwww_rrrr_iiii_tttt_eeee _ssss_iiii_dddd_eeee _****_////
  18.  
  19.    AAAArrrrgggguuuummmmeeeennnnttttssss
  20.      _q    Pointer to the queue.
  21.  
  22. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.      The _ssss_rrrr_vvvv (service) routine may be included in a STREAMS module or driver
  24.      for a number of reasons.  It provides greater control over the flow of
  25.      messages in a stream by allowing the module or driver to reorder
  26.      messages, defer the processing of some messages, or fragment and
  27.      reassemble messages.  The service routine also provides a way to recover
  28.      from resource allocation failures.
  29.  
  30.    RRRReeeettttuuuurrrrnnnn VVVVaaaalllluuuueeeessss
  31.      Ignored
  32.  
  33. UUUUSSSSAAAAGGGGEEEE
  34.      This entry point is optional, and is valid for STREAMS drivers and
  35.      modules only.
  36.  
  37.      A message is first passed to a module's or driver's _pppp_uuuu_tttt(D2) routine,
  38.      which may or may not process it.  The _pppp_uuuu_tttt routine can place the message
  39.      on the queue for processing by the service routine.
  40.  
  41.      Once a message has been enqueued, the STREAMS scheduler calls the service
  42.      routine at some later time.  Drivers and modules should not depend on the
  43.      order in which service procedures are run.  This is an implementation-
  44.      dependent characteristic.  In particular, applications should not rely on
  45.      service procedures running before returning to user-level processing.
  46.  
  47.      Every STREAMS queue [see _qqqq_uuuu_eeee_uuuu_eeee(D4)] has limit values it uses to implement
  48.      flow control.  High and low water marks are checked to stop and restart
  49.      the flow of message processing.  Flow control limits apply only between
  50.      two adjacent queues with service routines.  Flow control occurs by
  51.      service routines following certain rules before passing messages along.
  52.      By convention, high priority messages are not affected by flow control.
  53.  
  54.      STREAMS messages can be defined to have up to 256 different priorities to
  55.      support some networking protocol requirements for multiple bands of data
  56.      flow.  At a minimum, a stream must distinguish between normal (priority
  57.      band zero) messages and high priority messages (such as _MMMM______IIII_OOOO_CCCC_AAAA_CCCC_KKKK).  High
  58.      priority messages are always placed at the head of the queue, after any
  59.      other high priority messages already enqueued.  Next are messages from
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ssssrrrrvvvv((((DDDD2222))))                                                                ssssrrrrvvvv((((DDDD2222))))
  71.  
  72.  
  73.  
  74.      all included priority bands, which are enqueued in decreasing order of
  75.      priority.  Each priority band has its own flow control limits.  By
  76.      convention, if a band is flow-controlled, all lower priority bands are
  77.      also stopped.
  78.  
  79.      Once a service routine is called by the STREAMS scheduler it must provide
  80.      for processing all messages on its queue, restarting itself if necessary.
  81.      Message processing must continue until either the queue is empty, the
  82.      stream is flow-controlled, or an allocation error occurs.  Typically, the
  83.      service routine will switch on the message type, which is contained in
  84.      _mmmm_pppp_----_>>>>_bbbb______dddd_aaaa_tttt_aaaa_pppp_----_>>>>_dddd_bbbb______tttt_yyyy_pppp_eeee, taking different actions depending on the message
  85.      type.
  86.  
  87.      For singlethreaded modules and drivers, the framework for the canonical
  88.      service procedure algorithm is as follows:
  89.      _qqqq_uuuu_eeee_uuuu_eeee______tttt _****_qqqq_;;;;
  90.      _mmmm_bbbb_llll_kkkk______tttt _****_mmmm_pppp_;;;;
  91.      _wwww_hhhh_iiii_llll_eeee _((((_((((_mmmm_pppp _==== _gggg_eeee_tttt_qqqq_((((_qqqq_))))_)))) _!!!!_==== _NNNN_UUUU_LLLL_LLLL_)))) _{{{{
  92.           _iiii_ffff _((((_mmmm_pppp_----_>>>>_bbbb______dddd_aaaa_tttt_aaaa_pppp_----_>>>>_dddd_bbbb______tttt_yyyy_pppp_eeee _>>>> _QQQQ_PPPP_CCCC_TTTT_LLLL _||||_||||
  93.              _cccc_aaaa_nnnn_pppp_uuuu_tttt_((((_qqqq_----_>>>>_qqqq______nnnn_eeee_xxxx_tttt_))))_)))) _{{{{
  94.                _////_**** _pppp_rrrr_oooo_cccc_eeee_ssss_ssss _tttt_hhhh_eeee _mmmm_eeee_ssss_ssss_aaaa_gggg_eeee _****_////
  95.                _pppp_uuuu_tttt_nnnn_eeee_xxxx_tttt_((((_qqqq_,,,, _mmmm_pppp_))))_;;;;
  96.           _}}}} _eeee_llll_ssss_eeee _{{{{
  97.                _pppp_uuuu_tttt_bbbb_qqqq_((((_qqqq_,,,, _mmmm_pppp_))))_;;;;
  98.                _rrrr_eeee_tttt_uuuu_rrrr_nnnn_;;;;
  99.           _}}}}
  100.      _}}}}
  101.      If the singlethreaded module or driver cares about priority bands, the
  102.      algorithm becomes:
  103.      _qqqq_uuuu_eeee_uuuu_eeee______tttt _****_qqqq_;;;;
  104.      _mmmm_bbbb_llll_kkkk______tttt _****_mmmm_pppp_;;;;
  105.      _wwww_hhhh_iiii_llll_eeee _((((_((((_mmmm_pppp _==== _gggg_eeee_tttt_qqqq_((((_qqqq_))))_)))) _!!!!_==== _NNNN_UUUU_LLLL_LLLL_)))) _{{{{
  106.           _iiii_ffff _((((_mmmm_pppp_----_>>>>_bbbb______dddd_aaaa_tttt_aaaa_pppp_----_>>>>_dddd_bbbb______tttt_yyyy_pppp_eeee _>>>> _QQQQ_PPPP_CCCC_TTTT_LLLL _||||_||||
  107.              _bbbb_cccc_aaaa_nnnn_pppp_uuuu_tttt_((((_qqqq_----_>>>>_qqqq______nnnn_eeee_xxxx_tttt_,,,, _mmmm_pppp_----_>>>>_bbbb______bbbb_aaaa_nnnn_dddd_))))_)))) _{{{{
  108.                _////_**** _pppp_rrrr_oooo_cccc_eeee_ssss_ssss _tttt_hhhh_eeee _mmmm_eeee_ssss_ssss_aaaa_gggg_eeee _****_////
  109.                _pppp_uuuu_tttt_nnnn_eeee_xxxx_tttt_((((_qqqq_,,,, _mmmm_pppp_))))_;;;;
  110.           _}}}} _eeee_llll_ssss_eeee _{{{{
  111.                _pppp_uuuu_tttt_bbbb_qqqq_((((_qqqq_,,,, _mmmm_pppp_))))_;;;;
  112.                _rrrr_eeee_tttt_uuuu_rrrr_nnnn_;;;;
  113.           _}}}}
  114.      _}}}}
  115.      Each STREAMS module and driver can have a read and write service routine.
  116.      If a service routine is not needed (because the _pppp_uuuu_tttt routine processes all
  117.      messages), a _NNNN_UUUU_LLLL_LLLL pointer should be placed in the module's _qqqq_iiii_nnnn_iiii_tttt(D4)
  118.      structure.
  119.  
  120.      If the service routine finishes running because of any reason other than
  121.      flow control or an empty queue, then it must explicitly arrange for its
  122.      rescheduling.  For example, if an allocation error occurs during the
  123.      processing of a message, the service routine can put the message back on
  124.      the queue with _pppp_uuuu_tttt_bbbb_qqqq, and, before returning, arrange to have itself
  125.      rescheduled [see _qqqq_eeee_nnnn_aaaa_bbbb_llll_eeee(D3)] at some later time [see _bbbb_uuuu_ffff_cccc_aaaa_llll_llll(D3) and
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ssssrrrrvvvv((((DDDD2222))))                                                                ssssrrrrvvvv((((DDDD2222))))
  137.  
  138.  
  139.  
  140.      _iiii_tttt_iiii_mmmm_eeee_oooo_uuuu_tttt(D3)].
  141.  
  142.      Service routines can be interrupted by _pppp_uuuu_tttt routines, unless the processor
  143.      interrupt level is raised.
  144.  
  145.      Only one copy of a queue's service routine will run at a time.
  146.  
  147.      Drivers and modules should not call service routines directly.
  148.      _qqqq_eeee_nnnn_aaaa_bbbb_llll_eeee(D3) should be used to schedule service routines to run.
  149.  
  150.      Drivers (excepting multiplexors) should free any messages they do not
  151.      recognize.
  152.  
  153.      Modules should pass on any messages they do not recognize.
  154.  
  155.      Drivers should fail any unrecognized _MMMM______IIII_OOOO_CCCC_TTTT_LLLL messages by converting them
  156.      into _MMMM______IIII_OOOO_CCCC_NNNN_AAAA_KKKK messages and sending them upstream.
  157.  
  158.      Modules should pass on any unrecognized _MMMM______IIII_OOOO_CCCC_TTTT_LLLL messages.
  159.  
  160.      Service routines should never put high priority messages back on their
  161.      queues.
  162.  
  163.    SSSSyyyynnnncccchhhhrrrroooonnnniiiizzzzaaaattttiiiioooonnnn CCCCoooonnnnssssttttrrrraaaaiiiinnnnttttssss
  164.      Service routines do not have user context and so may not call any
  165.      function that sleeps.
  166.  
  167. RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
  168.      _bbbb_cccc_aaaa_nnnn_pppp_uuuu_tttt(D3), _bbbb_uuuu_ffff_cccc_aaaa_llll_llll(D3), _cccc_aaaa_nnnn_pppp_uuuu_tttt(D3), _dddd_aaaa_tttt_aaaa_bbbb(D4), _gggg_eeee_tttt_qqqq(D3), _mmmm_ssss_gggg_bbbb(D4),
  169.      _pppp_cccc_mmmm_ssss_gggg(D3), _pppp_uuuu_tttt(D2), _pppp_uuuu_tttt_bbbb_qqqq(D3), _pppp_uuuu_tttt_nnnn_eeee_xxxx_tttt(D3), _pppp_uuuu_tttt_qqqq(D3), _qqqq_eeee_nnnn_aaaa_bbbb_llll_eeee(D3),
  170.      _qqqq_iiii_nnnn_iiii_tttt(D4), _qqqq_uuuu_eeee_uuuu_eeee(D4), _iiii_tttt_iiii_mmmm_eeee_oooo_uuuu_tttt(D3)
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.